<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/common/init.jsp"%>
<html>
<head>
<title>澳斯浪廷会员平台</title>
<link href="<c:url value='/resources/css/css.css'/>" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<c:url value='/resources/js/jquery-1.7.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/validate.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/MathUtil.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/My97DatePicker/WdatePicker.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/mask.js'/>"></script>
</head>
<body leftmargin="0">
	<div class="main">
		<div class="width_l">
			<iframe src="menu.action" frameborder="0" width="250" height="100%" class="menu"></iframe>
		</div>
		<div class="right">
			<div class="width_r">
				<div class="menu_r">
					<ul>
						<li><a href="index.action">首页</a></li>
						<li><a href="information.action">消息</a></li>
						<li><a href="notice.action">公告中心</a></li>
						<li><a href="news.action">新闻中心</a></li>
						<li><a href="inbox.action">收件箱</a></li>
						<li><a href="tomail.action">写邮件</a></li>
						<li><a href="sent.action">已发送</a></li>
						<li><a href="${ctx}/exit.action">安全退出</a></li> 
					</ul>
				</div>
				<div class="news_top">
					<img src="<c:url value='/resources/images/top.jpg'/>" />
				</div>
				<div class="news">
					<h4>填写汇款单</h4>
					<form method="post" id="remit">
					
					<table width="400" border="0" cellpadding="0" cellspacing="0"
						style="margin-left: 300px; line-height: 32px; margin-top: 10px; color: #676767;">
						<tr>
							<td width="100" align="right">申请激活豆：</td>
							<td width="142">${apply.applyAmount}</td>
							<td width="158">&nbsp;<input type="hidden" value="${apply.id}" name="applyId"/></td>
						</tr>
						<tr>
							<td align="right">应汇款：</td>
							<td>${apply.cash}
								<input type="hidden" name="apply.cash" id="cash" value="${apply.cash}"/>
							</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="right">汇款时间：</td>
							<td> <input id="remitDate" type="text" size="20" name="remitDate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
							</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="right">汇款金额：</td>
							<td><input name="remitCash" type="text" id="remitCash" class="text" size="20" />
							</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="right">汇款银行：</td>
							<td> <input name="remitBank" type="text" id="remitBank" class="text" size="20" /></td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="right">卡号：</td>
							<td><input name="remitCard" type="text" id="remitCard" class="text" size="20" /></td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="right">汇款人：</td>
							<td><input name="remitPerson" type="text" id="remitPerson" class="text" size="20" /></td>
							<td>&nbsp;</td>
						</tr>
					</table>
					</form>
					<div class="tijiao">
						<img src="<c:url value='/resources/images/tijiao.jpg'/>" onclick="doSave();"/>
					</div>
					<div class="news_down">
						<img src="<c:url value='/resources/images/down.jpg'/>" />
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
<script type="text/javascript">
function doSave(){
	var patten = new RegExp(/^(([1-9]{1}\d*)|0)(\.\d+)?$/);
	if($.trim($("#remitDate").val()) == ""){
		alert("汇款时间不能为空");
		return false;
	}else if($.trim($("#remitCash").val()) ==""){
		alert("汇款金额不能为空");
		return false;
	}else if( $.trim($("#remitCash").val())!='' && !patten.test($.trim($("#remitCash").val()))){
		   alert("汇款金额 必须是数字！");
		   return false;
	}else if(dcmSub($.trim($("#remitCash").val()),$.trim($("#cash").val()))<0){
		alert("汇款金额少于应付款金额");
		return false;
	}else if($.trim($("#remitBank").val()) ==""){
		alert("汇款银行不能为空");
		return false;
	}else if($.trim($("#remitCard").val()) ==""){
		alert("汇款卡号不能为空");
		return false;
	}else if($.trim($("#remitPerson").val()) ==""){
		alert("汇款人不能为空");
		return false;
	}
	//document.forms[0].action = "${ctx}/applyactivity.action";
    //document.forms[0].submit();
    
    var data = $("#remit").serialize();
	$(document).mask("系统处理中，请稍后......");
	jQuery.ajax({
		url: "${ctx}/applyactivity.action",
		type: "post",
		dataType:"html",
		data:data,
		async:false,
		success: function(jsondata){
			alert(jsondata);
			window.location.href = "${ctx}/activity.action";
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
	    }
	});
}
</script>